package com.nondo.rdp.finance.service.impl.analysis;

import com.nondo.rdp.auth.domain.User;
import com.nondo.rdp.finance.domain.analysis.Analysis;
import com.nondo.rdp.finance.domain.analysis.AnalysisUp;
import com.nondo.rdp.finance.repository.analysis.AnalysisUpRepository;
import com.nondo.rdp.finance.service.analysis.AnalysisUpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Service
public class AnalysisUpServiceImpl implements AnalysisUpService {
    @Autowired
    AnalysisUpRepository analysisUpRepository;

    @Override
    public AnalysisUp findOne(Long id) {
        return this.analysisUpRepository.findOne(id);
    }

    @Override
    public AnalysisUp save(AnalysisUp analysisUp) {
        return this.analysisUpRepository.save(analysisUp);
    }

    @Override
    public void delete(Long id) {
        this.analysisUpRepository.deleteById(id);
    }

    @Override
    public AnalysisUp findByAnalysisAndUser(Analysis analysis, User user) {
        return this.analysisUpRepository.findByAnalysisAndUser(analysis, user);
    }
}